package com.polaris.live.popup.party

import android.content.Context
import com.lxj.xpopup.core.CenterPopupView
import com.polaris.live.R
import com.polaris.live.common.ext.setOnSingleClickListener
import com.polaris.live.databinding.PopupCloseGameBinding

/**
 * 关闭游戏提示
 *
 * @author Created by 天晴 on 2023/1/23/004 14:21
 */
class CloseGamePopup(
    context: Context,
    private val message: String,
    private val cancel: (() -> Unit),
    private val ok: (() -> Unit)
) : CenterPopupView(context) {

    private lateinit var mBinding: PopupCloseGameBinding

    override fun getImplLayoutId(): Int {
        return R.layout.popup_close_game
    }

    override fun onCreate() {
        super.onCreate()

        mBinding = PopupCloseGameBinding.bind(popupImplView)

        mBinding.tvCancel.setOnSingleClickListener {
            cancel.invoke()
            dismiss()
        }

        mBinding.tvOk.setOnSingleClickListener {
            ok.invoke()
            dismiss()
        }
        mBinding.tvTitle.text = message
    }
}